object ClubManagementSystem {
  def main(args: Array[String]): Unit = {

    val clubData = Map(
      "篮球社"->(42,2010,"体育"),
      "编程社"->(35,2015,"技术"),
      "足球社"->(38,2008,"体育"),
      "文学社"->(28,2012,"文化"),
      "摄影社"->(22,2018,"艺术")
    )
    val sportsClubs = clubData.filter { case (_,(_,_,typ)) =>
      typ == "体育"
    }
    println("体育类社团：")
    sportsClubs.foreach { case (name,(count,_,_)) =>
      println(s"$name - $count 人")
    }

    val totalMembers = clubData.values.map(_._1).sum
    val avgMembers = totalMembers.toDouble / clubData.size
    println(f"\n平均成员数：$avgMembers%.1f人")

    val oldsetClub = clubData.minBy { case(_,(_,year,_)) => year}
    println(s"\n成立最早的社团：${oldsetClub._1} (${oldsetClub._2._2}年)")
  }

}
